package fitness;

import org.jgap.FitnessFunction;
import org.jgap.IChromosome;

import character.Mage;

public class MageFitness extends FitnessFunction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2812562984152009804L;

	@Override
	protected double evaluate(IChromosome profile) {
		Integer strength = (Integer) profile.getGene(0).getAllele();
		Integer agility =  (Integer) profile.getGene(1).getAllele();
		Integer stamina =  (Integer) profile.getGene(2).getAllele();
		Integer intellect =  (Integer) profile.getGene(3).getAllele();
		Integer spirit =  (Integer) profile.getGene(4).getAllele();
		
		Mage mage = new Mage();
		mage.setStrength(strength);
		mage.setAgility(agility);
		mage.setStamina(stamina);
		mage.setIntellect(intellect);
		mage.setSpirit(spirit);
		
		double res =  2.525 * mage.getAttackPower() +
					  2.525 * mage.getArmor() + 
					  2.525 * mage.getSpeed() +
					  2.525 * mage.getResilience() + 
					  2.525 * mage.getDodgeRating() + 
					  3.030 * mage.getMana() +
					  1.011 * mage.getHealth() +
					 30.303 * mage.getSpellPenetration() +
					 22.728 * mage.getHaste() + 
					  2.525 * mage.getHealthRegeneration() +
					 27.778 * mage.getManaRegeneration();
		return res;
	}

}
